package t;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Author:大鱼
 * gitee:https://gitee.com/TheInit/leetcode
 * csdn:
 */
public class Wangyi {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
//        String s = "[[1,3],[3,0,1],[2],[0]]";
        s = s.substring(1, s.length() - 1);
        ArrayList<String> str = new ArrayList<>();
        while (s.length() > 0){
            int start1 = s.indexOf('[');
            int end1 = s.indexOf(']');
            str.add(s.substring(start1 + 1, end1));
            s = s.substring(end1 + 1);
        }
        ArrayList<ArrayList<Integer>> boxes = new ArrayList<>();
        for (int i = 0; i < str.size(); i++){
            ArrayList<Integer> tLIst = new ArrayList<>();
            String tStr = str.get(i);
            for (int j = 0; j < tStr.length(); j++){
                if (tStr.charAt(j) >= '0' && tStr.charAt(j) <= '9'){
                    tLIst.add(tStr.charAt(j) - '0');
                }
            }
            boxes.add(tLIst);
        }
        System.out.println(boxes.size());
        for (List<Integer> t : boxes) {
            System.out.println(t.toString());
        }
        sc.close();;
    }

    @Test
    public void test() {
        String s = "[1,3]";
        System.out.println(s.substring(1, s.length() - 1).toString());
    }
}
